package com.niit.work02;

import java.util.Scanner;

public class getResult {

    public static void main(String[] args)
    {
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入第一个数字");
        int a=scanner.nextInt();
        System.out.println("请输入第二个数字");
        int b=scanner.nextInt();
        System.out.println("请选择运算符：1.加法 2.减法 3.乘法 4.除法 5.取模 6.平方根");
        int operator=scanner.nextInt();

        getResult result=new getResult();
        System.out.println(result.result(a,b,operator));
    }
    public int result(int a,int b,int operator)
    {
        operatorFactory factory=new operatorFactory();
        return factory.getOperator(operator).calculate(a,b);
    }
}